<template>
  <div class="textarea-container">
    <textarea  :value="modelValue"   @input="$emit('update:modelValue', $event.target.value)" rows="3" :placeholder="props.placeholder"></textarea>
    <div class="operate-container">
      <div class="operate-left">
        <slot name="left"></slot>
      </div>
      <div class="operate-right">
        <slot name="right"></slot>
      </div>
    </div>
  </div>
</template>

<script setup>
const props = defineProps({
  placeholder: {
    type: String,
    default:'请填写信息...'
  },  modelValue: {  // 接收 v-model 的默认 prop
    type: String,
    default: ''
  }
})
const emit = defineEmits(['update:modelValue']) // 声明更新事件

</script>

<style scoped>
.textarea-container {
  width: 100%;
  background-color: var(--textarea-background-color);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  transition: 0.3s border;
}

.textarea-container:focus-within{
  border: 1px solid var(--border-active-color);
}



textarea {
  width: 100%;
  user-select: none;
  outline: none;
  border:none;
  background-color: var(--textarea-background-color);
  resize: none;
  font-size: 16px;
  color: var(--color);
}

.operate-container {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  width: 100%;
}



</style>
